<template>
  <el-container>
    <el-header>Header</el-header>
    <el-container>
      <el-aside width="200px">
        <el-menu
          :default-active="defaultMenu"
          class="el-menu-vertical-demo"
          :router="false"
          background-color="#fff"
          text-color="#545c64"
          active-text-color="#ffd04b"
          
        >
          <el-submenu index="1">
            <template slot="title">
              <i class="el-icon-menu"></i>
              <span>组件列表</span>
            </template>
            <el-menu-item-group>
              <el-menu-item
                v-for="item in menuList"
                :key="item.index"
                :index="item.index"
                @click="handleClickMenu(item)"
                >{{ item.title }}</el-menu-item
              >
            </el-menu-item-group>
          </el-submenu>
        </el-menu>
      </el-aside>
      <el-container>
        <el-main>
            <router-view></router-view>
        </el-main>
        <el-footer>Footer</el-footer>
      </el-container>
    </el-container>
  </el-container>
</template>
<script>
export default {
  data() {
    return {
      isCollapse: true,
      defaultMenu:'0',
      menuList: [
        { index: "daping1", title: "数据大屏",link:'http://localhost:8081/free/daping1' },
        { index: "/notes", title: "笔记",link:'http://tzz_12.gitee.io/demo/' },
        { index: "/free/tabledemo", title: "表格" },
      ],
    };
  },
  methods: {
    handleOpen(key, keyPath) {
      console.log(key, keyPath);
    },
    handleClose(key, keyPath) {
      console.log(key, keyPath);
    },
    handleClickMenu(menu){
        if(menu.link){
            window.open(menu.link,"_blank")
        }else{
            this.$router.resolve(menu.path)
        }
    }
  },
};
</script>
<style scoped>
.el-menu-vertical-demo:not(.el-menu--collapse) {
  width: 200px;
  height: 100vh;
}
header {
  height: 62px;
  width: 100%;
  font-size: 30px;
  font-weight: bold;
}
</style>